Subtractive color method, subtractive color processing apparatus, image forming apparatus, and computer-readable storage medium for computer program

ABSTRACT

A most used color that is a most popularly used color is obtained in an image. Pixel groups formed of continued pixels having an identical color other than the most used color in the image is extracted as first pixel groups. Pixel groups having a color of which a color difference with respect to the most used color is smaller than a predetermined threshold and having a size thereof that is smaller than a predetermined size is extracted as third pixel groups among the first pixel groups thus extracted. The first pixel groups other than the third pixel groups are taken as second pixel groups. An image is generated by replacing colors of portions, which correspond to the second pixel groups in an image having an area identical with that of an image to be processed and filled with the most used color, with the corresponding second pixel groups, respectively.

This application is based on Japanese Patent Application No. 2008-152188filed on Jun. 10, 2008, the contents of which are hereby incorporated byreference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a subtractive color method applied toimage data that has been scanned by a scanner, and an image formingapparatus etc. that perform subtractive color processing.

2. Description of Related Art

In recent years, digitization of information has been progressing, andit has become common to digitize information recorded on a paper mediumfor storing. When performing digitization, a document is scanned using ascanner, and image data obtained by scanning is converted into apredetermined storing format and stored as digitized data. Presently,PDF (Portable Document Format) is widely used as the storing format.When the image data is converted into a file in PDF format and stored,an amount of data thereof can be greatly reduced. However, when a filein PDF format (PDF file) is generated, usually, compression using theJPEG (Joint Photographic Experts Group) method is performed on the imagedata. As a result, a slight degradation in image quality is inevitable.Accordingly, to maintain a compression ratio unchanged while the imagequality is kept as high as possible, there is proposed a method forperforming compression that is suited to each area included in an image(target image) represented by the image data to be stored. According tothis method, a PDF file is generated, for example, in a way as describedbelow.

First, an area represented by an object such as text, photograph, table,graph, or graphics included in the target image is extracted. Then, itis determined whether the extracted area is a text area or a non-textarea. Binarization is performed on the text area, and one representativecolor is decided for the text. Further, compression processing by takingthe legibility of the text into account is performed. Compressionprocessing at a high compression rate is performed on a photograph area.Image processing such as subtractive color processing is performed on anarea that is neither the text area nor the photograph area (hereinafter,referred to as “graphics/table/graph area”), namely, a table area, agraph area, or a graphics area, and compression is performed thereonwith a high resolution maintained. Thereafter, a PDF file is generatedby using the compressed data of individual areas.

With this arrangement, it is possible to output a PDF file having ahigher image quality while having a similar amount of data as in theconventional method.

As shown in FIG. 18, an image of graph has the characteristics ofincluding many of portions that are supposed to be expressed by a singlecolor such as a bar portion AB in a bar graph and a background portionAH serving as a background to the bar. A table and graphics also havesimilar characteristics. Usually, when a document is scanned, aplurality of colors are included in such an area which is supposed to beexpressed by a single color because of uneven density in color.Accordingly, for such an object including many portions that aresupposed to be expressed in a single color, such as graph, table, andgraphics, the image quality and the compression ratio are expected to beimproved particularly by performing the subtractive color processingthereon. As an art relating to the subtractive color processing, suchtechnologies as described in JP-2002-300412-A and JP-H06-103371-A areproposed.

According to a method described in JP-2002-300412-A, an inputted imageis divided into small areas by a predetermined method, and colors arereduced by reducing halftone levels in each of the small areas.

According to a method described in JP-H06-103371-A, a plurality ofrepresentative colors are selected from a color image to be processed,and colors that are not selected as the representative colors aresubstituted by representative colors most closest thereto, respectively.The color image is divided based on the representative colors to obtaina plurality of partial image areas. If it is determined that a change inimage quality is not visually recognized when one of the partial imageareas and another adjacent thereto are integrated, the one of thepartial image areas is integrated into the another of the partial imageareas adjacent thereto. The integration process is repeated for each ofthe partial image areas to thereby reduce colors in the entire colorimage.

According to the conventional method described in JP-2002-300412-Aexplained above, since colors are reduced by reducing the number ofhalftone levels, areas having similar colors may be converted into areashaving an identical color. As a result, in the case where there are aplurality of bars having similar colors but different meanings, forexample, as in the case of FIG. 18, the plurality of bars could beconverted to the bars in an identical color. If such conversion isperformed, the significance of the graph is changed. Therefore, thismethod is not suitable for reducing colors in the graphics/table/grapharea.

According to the conventional method described in JP-H06-103371-Aexplained above, one of partial image areas and another of partial imageareas adjacent thereto are compared, and it is determined whether or nota change in image quality can be visually recognized if the two areasare integrated. This way of determination is performed on each of thepartial image areas that are adjacent to the one of the partial imageareas. Then, if it is determined that no change in image quality isvisually recognized, the integration is performed. Since thisintegration process is performed further for all of the partial imageareas one by one, an amount of calculation increases, and it may take along time to process.

SUMMARY OF THE INVENTION

In view of the problem described above, it is an object of the presentinvention to perform subtractive color processing in a preferable mannerand in a way simpler than that in the conventional case on an imageincluding many areas, such as areas of graph, table, and graphics, eachof which is supposed to be expressed in a single color.

According to an embodiment of the present invention, a subtractive colormethod includes the following steps. A most used color that is a mostpopularly used color in an image is obtained. Small pixel groups havinga color of which a color difference with respect to the most used coloris smaller than a predetermined threshold value and having a sizethereof that is smaller than a predetermined size are extracted fromamong pixel groups formed of continued pixels having an identical colorother than the most used color in the image. A resultant image resultedfrom applying the most used color to portions corresponding to the smallpixel groups in the image is generated.

According to another embodiment of the present invention, a subtractivecolor method includes the following steps. In a first step, a most usedcolor that is a most popularly used color in a first image having apredetermined size is obtained. In a second step, pixel groups formed ofcontinued pixels having an identical color other than the most usedcolor in the first image are extracted as first pixel groups. In a thirdstep, the pixel groups having a color of which a color difference withrespect to the most used color is larger than a predetermined thresholdvalue or having a size thereof that is larger than a predetermined sizeare defined as second pixel groups among the first pixel groups thusextracted, an image having an area identical with that of the firstimage and filled with the most used color is obtained as a second image,then portions corresponding to the second pixel groups are replaced withthe second pixel groups, respectively, so that a resultant image, basedon the second image, having the portions of which colors are replacedwith colors of the corresponding second pixel groups, respectively, isgenerated.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an example of a hardware configuration of an imageforming apparatus according to an embodiment of the present invention.

FIG. 2 illustrates an example of a functional configuration of the imageforming apparatus.

FIGS. 3A and 3B illustrate an example of an image of a document.

FIGS. 4A and 4B illustrate uneven density in an image of a bar graph.

FIG. 5 illustrates an example of a configuration of a color correctionprocessing portion.

FIG. 6 is a flowchart depicting a flow of color correction processing bya first method.

FIG. 7 is a histogram illustrating relationships between density valuesof pixels and the number of pixels of a graphics/table/graph block.

FIGS. 8A to 8D illustrate distributions of pixels of thegraphics/table/graph block in RGB color space.

FIG. 9 illustrates each of obtained representative colors in RGB colorspace.

FIGS. 10A to 10D illustrate an example of a bar graph image depictingstages during a process until the completion of the process according tothe first method.

FIG. 11 illustrates an example of a configuration of the colorcorrection processing portion.

FIG. 12 illustrates a circle graph as an object to be processed by asecond method.

FIG. 13 is a flowchart depicting a flow of color correction processingby the second method.

FIGS. 14A to 14C illustrate an example of a circle graph image depictingstages during a process until the completion of the process according tothe second method.

FIGS. 15A to 15C illustrate the example of the circle graph imagedepicting stages during the process until the completion of the processaccording to the second method.

FIGS. 16A to 16D illustrate the example of the circle graph imagedepicting stages during the process until the completion of the processaccording to the second method.

FIG. 17 is a flowchart depicting a flow of overall processes performedby the image forming apparatus when a PDF file is generated.

FIG. 18 illustrates a bar graph image.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

FIG. 1 illustrates an example of a hardware configuration of an imageforming apparatus 1 according to an embodiment of the present invention.

The image forming apparatus 1 is an image processing apparatus thatintegrates a variety of functions, such as copying, scanning, faxing,network printing, document server functionality, and file transferfunctionality. Such an apparatus is also sometimes called a combinationmachine or an MFP (Multi-Function Peripheral).

As shown in FIG. 1, the image forming apparatus 1 is configured of ascanner 10 a, a CPU 10 b, a hard disk 10 c, a RAM 10 d, a ROM 10 e, aprinting device 10 f, a modem 10 g, a network interface 10 h, a controlcircuit 10 k, an operational panel 10 m, and so on.

The scanner 10 a is a device that optically scans images such asphotographs, text, drawings, charts, and so on that are printed on apaper document (hereinafter, simply referred to as “document”) andcreates digital data thereof. The scanned image is stored as image datain a format, such as TIFF, JPEG, or bitmap, expressed as RGB (red (R),green (G), and blue (B)). It is also possible to store the image data inthe PDF format (Portable Document Format) by specifying that format inadvance.

The CPU 10 b performs processing for converting the image data of thedocument scanned by the scanner 10 a into a file in a format such asTIFF, JPEG, bitmap, or PDF. The CPU 10 b also performs overall controlof the image forming apparatus 1, such as detecting input from a user,controlling displays made on the operational panel 10 m, and thecreation of e-mail.

The printing device 10 f is a device for printing, onto a paper, animage represented by the image data obtained by scanning using thescanner 10 a or an image represented by the image data sent from anotherdevice. In the case where the image forming apparatus 1 is capable ofcolor printing, the printing is performed using four colors of toner,namely, yellow, magenta, cyan, and black.

The operational panel 10 m is a device through which the user makesvarious inputs with respect to the image forming apparatus 1 and is madeup of an operation portion, a display portion, etc. Using theoperational panel 10 m, the user can perform various input operations,such as selecting the format in which to store image data, settingscanning conditions, inputting commands to start or execute processes,and inputting e-mail addresses.

The modem 10 g incorporates an NCU (Network Control Unit) and connectsto another fax terminal via an analog public line to perform datacontrol and modulation/demodulation of fax data based on a facsimileprotocol, and so on.

The network interface 10 h is a NIC (Network Interface Card), and is forconnecting to another device via a ILAN, the Internet, or the like.

The control circuit 10 k is a circuit for controlling devices such asthe hard disk 10 c, the operational panel 10 m, the scanner 10 a, theprinting device 10 f, the modem 10 g, and the network interface 10 h.The control circuit 10 k can be formed of, for example, hardwarecircuitry using various electronic components.

The hard disk 10 c stores programs, data, and so on for implementing thefunctions of the various portions described later using FIG. 2. Theseare read out and stored as necessary in the RAM 10 d, and the programsare executed by the CPU 10 b. Part or all of these programs or data maybe stored in the ROM 10 e. Alternatively, some or all of the functionsshown in FIG. 2 may be implemented by the control circuit 10 k.

FIG. 2 illustrates an example of a functional configuration of the imageforming apparatus 1. FIGS. 3A and 3B illustrate an example of an imageof a document. FIGS. 4A and 4B illustrate uneven density in a bar graphimage. Next, a description will be given of processes performed by thevarious portions of the image forming apparatus 1 when document imagedata GD obtained by using the scanner 10 a to scan the document isconverted into a file in PDF format (PDF file) and then the resultantfile is stored.

As shown in FIG. 2, the image forming apparatus 1 is configured of animage data acquisition portion 11, a preprocessing portion 12, an areaextraction portion 13, an area discrimination portion 14, a colorcorrection processing portion 15, a graph compression processing portion16, a text/background separation portion 17, a text compressionprocessing portion 18, a resolution reduction portion 19, a backgroundcompression processing portion 20, a file generation portion 21, a filestoring portion 22, and the like.

When the user sets the document in the scanner 10 a, sets the storingformat to PDF, and inputs a command to execute the scan, the scanner 10a scans the image of the document, and generates document image data GDexpressed in RGB in a format such as bitmap. Here, it is assumed thatthe document has an image including a graph illustrated in FIG. 3Aprinted thereon.

The image data acquisition portion 11 then acquires the document imagedata GD. The preprocessing portion 12 generates image data representedby hue, saturation, and lightness by performing HSL conversion on thedocument image data GD, and further binarizes image data of lightness(lightness image data)

The area extraction portion 13 extracts areas depicting each of theobjects such as text, photograph, graphics, graph, and table that areincluded in the image (document image) of the document image data GD.This process is performed in cooperation with the preprocessing portion12, for example, in the following manner.

The preprocessing portion 12 generates lightness image data from thedocument image data GD and binarizes the lightness image data thusgenerated. The area extraction portion 13 performs labeling on thebinarized image (binary image) obtained through binarization. This meansthat black pixel groups, which are black pixels that are laiduninterruptedly next to each another in the binary image, are detected.The black pixel groups located relatively close to each another aredetected as one black pixel group. Through this process, the pixel groupthat forms an object is detected as a black pixel group. Then, a regionof quadrangle shape (quadrangular region) that encapsulates the detectedblack pixel group is defined. For example, the coordinates of the pixelsat the top-left and bottom-right in the binary image within thequadrangular region are obtained. Through this process, as shown in FIG.3B, blocks BK1, BK2, and so on which are quadrangular regions each ofwhich encapsulates each of the objects in the document image, areobtained. Hereinafter, each of the blocks BK1, BK2, and so on may becollectively referred to as “block BK”. Similarly, other data orelements may be collectively referred to by omitting a serial number oran alphabetical letter added after a reference symbol.

The area discrimination portion 14 determines the type of block BK basedon the size of the block BK or the properties of the image in the blockBK. In the present embodiment, the area discrimination portion 14determines which of the types, namely text, photograph, graph, table, orgraphics, each block belongs to. The photograph area, for example, isdetermined based on the lightness and the hue of the image. Usually, itis often the case that many colors are used in the photograph image.Therefore, if the dispersion degrees of hue and lightness in an image ofa block BK are large, then the type of that block BK is determined asphotograph.

Generally, images of graph, table, graphics, and the like contain manyportions that are supposed to be expressed by a single color. Theportions that are supposed to be expressed by a single color, although aplurality of colors may be included in actual cases, are supposed to beessentially expressed by a single color and appear to be expressed by asingle color to human eyes.

For example, in the case of the image of the bar graph in FIG. 3A, thebar portion AB in the graph and the background portion AH serving as abackground to the bar in the graph are the portions that are supposed tobe expressed by a single color. However, in the image represented by thedocument image data GD that is obtained by scanning, although theportions that are supposed to be expressed by a single color appear tobe expressed in a single color as a whole, there is minute unevendensity in color as shown in FIG. 4A in an enlarged view. This meansthat not a single color but a plurality of colors are included.

The color correction processing portion 15 performs processing (colorcorrection processing) for properly removing the above-mentioned unevendensity included in the image within the block BL whose type isdetermined as graph, table, or graphics. The color correction processingis implemented by the first method or the second method. Such methodswill be described in detail later.

The graph compression processing portion 16 compresses data, which hasbeen subjected to the color correction processing, using a losslesscompression technique such as the FLATE method.

The text/background separation portion 17 performs processing forseparating the text portion from the background portion included in theblock BK that is determined by the area discrimination portion 14 as atext type.

The text compression processing portion 18 compresses data of pixelsthat constitute the text using a lossless compression technique such asthe MMR method. In this process, the compression is made withoutperforming resolution reduction processing.

The resolution reduction portion 19 performs resolution reductionprocessing on a portion of the document image corresponding to a blockBK that is determined as a photograph type. In addition, the resolutionreduction portion 19 performs resolution reduction processing on abackground portion that is so identified by the text/backgroundseparation portion 17.

The background compression processing portion 20 compresses the data ofa background to the photograph or the text, after the resolutionreduction processing is applied thereto, using a lossy compressiontechnique such as the JPEG method.

The file generation portion 21 generates a PDF file by using pieces ofcompressed data produced by the graph compression processing portion 16,the text compression processing portion 18, and the backgroundcompression processing portion 20, respectively. The file storingportion 22 stores the generated PDF file.

FIG. 5 illustrates an example of a configuration of a color correctionprocessing portion 15A; FIG. 6 is a flowchart depicting a flow of colorcorrection processing by the first method; FIG. 7 is a histogramillustrating relationships between each density value of pixels and thenumber of pixels in a graphics/table/graph block BKz; FIGS. 8A to 8Dillustrate distributions of pixels of the graphics/table/graph block BKzin RGB color space; FIG. 9 illustrates each of obtained representativecolors in RGB color space; and FIGS. 10A to 10D illustrate an example ofa bar graph image depicting stages during a process until the completionof the process according to the first method.

As shown in FIG. 5, the color correction processing portion 15 isconfigured of a representative color extraction portion 101, arepresentative color integration portion 102, a color setting portion103, a pixel counting portion 104, a deletion area specifying portion105, a single-color image generation portion 106, an image paint-overprocessing portion 107, etc, and performs color correction processing bythe first method on an image in a block BK (hereinafter,“graphics/table/graph block BKz”) whose type is determined as graph,table, or graphics by the area discrimination portion 14.

In FIG. 5, the representative color extraction portion 101 obtains apredetermined number of representative colors for thegraphics/table/graph block BKz based on the density value of each of RGBcolors of individual pixels in the graphics/table/graph block BKz (step#101 in FIG. 6). Here, a description will be given of how to obtain therepresentative colors with reference to FIG. 7 and FIGS. 8A-8D.

FIG. 7 is an example of a histogram indicating the number of pixels foreach of RGB colors in the graphics/table/graph block BKz at each densityvalue. FIG. 8A illustrates distributions of pixels in the image of thegraphics/table/graph block BKz in RGB color space. FIGS. 8A to 8D aredepicted using rectangular parallelepipeds to indicate the distributionsin a simplified manner. Note that a set of pixels in thegraphics/table/graph block BKz is expressed by “set S1”.

Before obtaining the representative colors, first, a dispersion degreein density of the pixels in the graphics/table/graph block BKz for whichthe representative colors are sought is obtained for each of RGB colorsbased on Equation (1) described below. Then, the largest dispersiondegree among RGB colors is detected.

$\begin{matrix}{( {{dispersion}\mspace{14mu} {degree}} ) = {\sqrt{\frac{1}{N}{\overset{N - 1}{\sum\limits_{i = 0}}( {X_{i} - X_{ave}} )}}}^{2}} & {{Equation}\mspace{14mu} (1)}\end{matrix}$

(where X_(i) represents density value of each pixel, X_(ave) representsaverage value of density values in the graphics/table/graph block BKz,and N represents the number of pixels in the graphics/table/graph blockBKz.)

In the case of the example in FIG. 7, the dispersion degree is large insuch a distribution as shown in the histogram of color B. Hereinafter, adescription will be given assuming that the dispersion degree of color Bindicates the maximum.

An average value of the density values for color B for which thedispersion degree indicates the maximum is obtained. As illustrated inFIG. 8A, the set S1 is divided along a plane perpendicular to an axis Bpassing through that average value.

Through this process, the set S1 is divided into sets S2 and S3 as shownin FIG. 8B. The distributions of pixels belonging to the sets S2 and S3,respectively, in RGB color space are assumed to be like the ones shownin FIG. 8C.

A dispersion degree of each of RGB colors will be obtained for each ofthe newly created sets S2 and S3. Through this process, six dispersiondegrees can be obtained. Then, the largest among the six dispersiondegrees is obtained. In this example, it is assumed that the color R ofthe set S2 has the maximum dispersion degree.

An average value of the density values for color R in the set S2 whichshows the maximum among the six dispersion degrees is obtained. The setS2, which indicates the maximum dispersion degree, is divided along aplane perpendicular to an axis R passing through that average value. Asa result, three sets, namely sets S21, S22, and S3, are created as shownin FIG. 8D. A dispersion degree for each of RGB colors for each of thesethree sets is obtained, and the division is performed in a similarmanner. Such division will be repeated until the number of sets Sreaches a predetermined number.

When the number of sets S reaches the predetermined number, an averagevalue of the density values for each of RGB colors in each of the sets Sis obtained. In each of the sets S, a color represented by theindividual average values of RGB colors is then recorded as arepresentative color for each of the sets S. Through this process, aplurality of representative colors (representative colors P1, P2, and soon) are obtained. In this embodiment, about 16-20 representative colorsare obtained.

It is to be noted that, when the set S is divided, instead of using theplane passing through the average value of the density values of thecolor that indicates the maximum dispersion degree, it is also possibleto use a plane passing through the lowest point in a valley of thehistogram for that color, that is, a plane passing through a densityvalue at a point TN where the number of pixels becomes smallest, tothereby divide the set S.

The representative color integration portion 102 obtains a colordifference between the obtained representative colors, and performsprocessing for integrating the representative colors of which the colordifference is equal to or lower than a predetermined threshold value(step #102). The color difference between the representative colors isexpressed by a distance between the representative colors in RGB colorspace, as shown in FIG. 9. The distance between the representativecolors is obtained based on Equation (2) shown below.

$\begin{matrix}{( {{color}\mspace{14mu} {difference}} ) = \sqrt{( {R_{a} - R_{b}} )^{2} + ( {G_{a} - G_{b}} )^{2} + ( {B_{a} - B_{b}} )^{2}}} & {{Equation}\mspace{14mu} (2)}\end{matrix}$

(where R_(a), G_(a), and B_(a) represent individual density values ofRGB colors of one representative color; and R_(b), G_(b), and B_(b)represent individual density values of RGB colors of the otherrepresentative color, respectively.)

The integration of the representative colors is performed by, forexample, obtaining an average value of density values for each of RGBcolors between two representative colors to be integrated (for example,an average value for color R is (Ra+Rb)/2; an average value for color Gis (Ga+Gb)/2; and so on), and assigning a color expressed by therespective average values of RGB colors as an integrated representativecolor. Alternatively, instead of using a simple average value asdescribed above, a weighted average value, which is weighted inaccordance with the numbers of pixels included in respective sets S towhich the two representative colors belong, may be used. Then, a colorexpressed by the respective weighted average values for RGB colors maybe assigned as an integrated representative color.

Instead of using the predetermined threshold value for integrating therepresentative colors as discussed above, it is also possible to decideon representative colors that will be subjected to the integration bychoosing representative colors having the smallest color differencefirst and thereafter in increasing order of the color difference, sothat the chosen representative colors undergo the integration processingsequentially until the number of the representative colors reaches apredetermined number. In this case, the integration processing ends whenthe number of representative colors is reduced to 10 or so.

The color setting portion 103 sets the representative color, which hasbeen decided for a set S, to each pixel that belongs to the set S andstores the result (step #103). When the representative colors areintegrated into an integrated representative color, the integratedrepresentative color is set to the pixels belonging to two sets S forwhich respective two representative colors have been chosen prior to theintegration.

Alternatively, the individual representative colors that have beenobtained are compared with original colors of individual pixels(original colors in the document image). Through the comparison, arepresentative color having the smallest color difference with respectto the individual pixels may be set as a representative color for theindividual pixels.

The pixel counting portion 104 obtains the number of pixels to which arepresentative color is set for each of the representative colors (step#104). Hereinafter, in the first method, a representative colorcorresponding to the largest number of pixels to which therepresentative color is set is referred to as “most-used color”, and therepresentative colors other than the most used color are referred to as“non-most-used color”. This most-used color is obtained, for example,based on a histogram that is generated to indicate a relationshipbetween the representative colors and the numbers of pixels.

As shown in FIG. 4A, a portion that is supposed to be expressed by asingle color includes a plurality of colors due to uneven density. Byexpressing the pixels having similar colors by a single representativecolor as described above, the number of colors is greatly reduced, andthe uneven density is removed to a certain extent as shown in FIG. 4B.However, as seen in Fig. 4B, some uneven density may remain.

The deletion area specifying portion 105 performs processing forspecifying a minute area left as shown in FIG. 4B and forming the unevendensity as noise to be deleted. The processing is performed as describedbelow.

Labeling is performed on a pixel group that is formed of continuouspixels of an identical non-most-used color (step #105). This means thata quadrangular region encapsulating individual pixel groups is obtained.Hereinafter, the quadrangular region is referred to as “identical-colorblock DK”.

Among the obtained identical-color blocks DK, an identical-color blockDK which has a color difference between the color (non-most-used color)of the encapsulated pixel group and the most-used color is equal to orless than a threshold value and a size smaller than a predetermined sizeis specified as an identical-color block DK to be deleted (step #106).Hereinafter, the identical-color block DK to be deleted is referred toas “block DKs to be deleted”, and an identical-color block DK other thanthe block DKs to be deleted is referred to as “block DKh not to bedeleted”.

The single-color image generation portion 106 and the image paint-overprocessing portion 107 generate, in a manner described below, an imageof the graphics/table/graph block BKz from which a portion correspondingto the block DKs to be deleted which is specified so by the deletionarea specifying portion 105 is deleted.

The single-color image generation portion 106 generates an image(single-color image) having an area that is identical with that of thegraphics/table/graph block BKz to be processed and filled with themost-used color as shown in FIG. 10A (step #107).

The image paint-over processing portion 107 generates an image shown inFIG. 10C by deleting the pixel groups of the block DKs to be deletedfrom an image expressed by pixel groups of the block DKs to be deletedand the block DKh not to be deleted shown in FIG. 10B and draws theimage thus generated over a single-color image (step #108). To bespecific, a portion in the single-color image which corresponds to thepixel groups of the block DKh not to be deleted is replaced with thepixel groups of the block DKh. An image thus generated is equivalent toan image that is generated by replacing the color in each correspondingportion in the single-color image with the color of the correspondingpixel group. Through this process, the noise that causes the unevendensity shown in FIG. 4B is removed, and an image having the backgroundportion AH serving as a background to the graph expressed by a singlecolor is generated.

In other words, according to the process describe above, anidentical-color block DK encapsulating pixel groups that are formed ofcontinuous pixels having an identical color is defined. Anidentical-color block DK having a color difference between a color ofpixel groups that are encapsulated and a most-used color smaller than apredetermined threshold value and at the same time having a size smallerthan a predetermined size is extracted as a block to be deleted. In asingle-color image that is obtained when an area having the same size asthe image of the graphics/table/graph block BKz to be processed isfilled with the most-used color, an image having portions correspondingto the pixel groups of the identical-color block DK other than thoseextracted as a block to be deleted is generated by replacing the colorwith the color of the pixel groups.

Alternatively, a similar image may be generated in the followingprocedure. Among pixel groups formed of continuous pixels having anidentical color other than the most-used color, a pixel group having acolor difference between the most-used color and the color of the pixelgroup smaller than a predetermined value and having a size smaller thana predetermined size is extracted. Then, a portion corresponding to theextracted pixel group in an image to be processed is filled with themost-used color, and an image thus processed is generated.

In stead of the above, the following procedure may be used to generatethe image. An identical-color block DK encapsulating pixel groups thatare formed of continued pixels having an identical color is defined. Anidentical-color block DK is extracted if it encapsulates pixel groupswhose color difference with respect to the most-used color is largerthan a predetermined threshold value or if it has a size larger than apredetermined size. In a single-color image that is obtained when anarea having the same size as the image of the graphics/table/graph blockBKz to be processed is filled with the most-used color, a portioncorresponding to the extracted identical-color blocks DK is replacedwith the pixel groups of the corresponding identical-color blocks, sothat an image having the corresponding portions replaced with the colorof the pixel groups is generated.

FIG. 11 illustrates an example of a configuration of the colorcorrection processing portion 15B. FIG. 12 illustrates a circle graph asan object to be processed by a second method. FIG. 13 is a flowchartdepicting a flow of color correction by the second method. FIGS. 14A to16D illustrate an example of a circle graph image depicting stagesduring a process until the completion of the process according to thesecond method.

The color correction processing portion 15B shown in FIG. 11 performscolor correction processing by the second method. In the second method,by repeating the processing for removing the noise until a predeterminedcondition is satisfied, an image is generated so as to have an imagequality superior to that in the first method and an amount of datasmaller than that in the first method. Hereinafter, a description willbe given of an example when the graphics/table/graph block BKz (blockBK5 in FIG. 3B) including the image of the circle graph shown in FIGS.3A and 3B is to be processed. As shown in FIG. 12, hereinafter, eachsector of the circle graph is referred to as graph areas Rn1, Rn2, andso on, and an area serving as a background to the circle graph isreferred to as an outer graph area Rg1. Although the graph area Rn3 isexpressed by diagonal lines, it is an area supposed to be expressed by asingle color as in the case of other graph areas.

In FIG. 11, a representative color extraction portion 101 obtains apredetermined number of representative colors for thegraphics/table/graph block BKz to be processed (step #201 in FIG. 13). Arepresentative color integration portion 102 integrates therepresentative colors, among the obtained representative colors, havinga color difference between one and another smaller than a predeterminedthreshold value (step #202). A color setting portion 103 sets arepresentative color of a set S to each pixel that belongs to the set Sand stores the result (step #203). A pixel counting portion 104 counts,for each of the representative colors, the number of pixels to which therepresentative color is set (step #204), and stores the representativecolor set to the largest number of pixels, as a first most-used color.In this example, the color of the graph area Rn1 having the largest areaand thus including the largest number of pixels is defined as the firstmost-used color.

The first most-used color is dealt with as a target representativecolor, and the processing in step #205 and onward is performed. If thenumber of pixels set with the first most-used color, i.e., the targetrepresentative color, is equal to or larger than a predetermined number(Yes in step #205), a deletion area specifying portion 105B performsprocessing for removing pixels deemed to be noise in pixel areas (areasindicated by black dots in FIG. 14A) having representative colors otherthan the first most-used color (hereinafter, referred to as “firstnon-most-used color”). In doing so, for respective pixel groups formedof pixels having an identical first non-most-used color, identical-colorblocks DK encapsulating such pixel groups are obtained (step #206).Among the obtained identical-color blocks, an identical-color block DKis specified as a block DKs to be deleted if it encapsulates pixelgroups having a color (that is, the first non-most-used color given tosuch pixel groups) whose color difference with respect to the firstmost-used color is smaller than a predetermined threshold value and ifit has a size smaller than a predetermined size (step #207). As shown inFIG. 14A, the pixel group expressed by a black dot in the graph area Rn1has a color close to the first most-used color which is a color ofneighboring pixels, and an identical-color block DK encapsulating such apixel group is small. Consequently, the identical-color block DKencapsulating such a pixel group is specified as a block DKs to bedeleted.

The single-color image generation portion 106B generates a single-colorimage having an area identical with that of the graphics/table/graphblock BKz to be processed and filled with the first most-used color asshown in FIG. 14B (step #208).

Then, a representative color which is set to the largest number ofpixels among the first non-most-used colors, i.e., a representativecolor among the representative colors obtained by the representativecolor extraction portion 101 and set to the second largest number ofpixels (hereinafter, referred to as “second most-used color”) undergoesthe processing in step #205 and onward as a target representative color.Hereinafter, the first most-used color, the second most-used color, andso on may be referred to simply as “most-used color”.

In this example, many of the pixels included in the graph area Rn2having the second largest area are set with the second most-used colorhaving the second largest number of pixels.

If the number of pixels having the second most-used color that is thetarget representative color is equal to or larger than a predeterminednumber (Yes in step #205), an area (area shown in black color in FIG.14C) obtained by deleting the pixels of the block DKs to be deleted thatis so specified in step #208 from the area (area shown in black color inFIG. 14A) of pixels having the first non-most-used color undergoesprocessing in steps #206 to #208 as an area to be processed.

In the process, the deletion area specifying portion 105B removes pixelsthat are deemed to be noise from an area shown in black color in an area(area shown in black color in FIG. 15A) of pixels having the firstnon-most-used color (hereinafter, referred to as “second non-most-usedcolor) other than the second most-used color. First, for each of thepixels configured of pixels having an identical second non-most-usedcolor, identical-color blocks DK encapsulating respective pixel groupsare obtained (step #206). Among the obtained identical-color blocks DK,an identical-color block DK is specified as a block DK to be deleted ifit encapsulates pixel groups having a second non-most-used color whosecolor difference with respect to the second most-used color is equal toor smaller than a predetermined threshold value and if it has a blocksize smaller than a predetermined size (step #208). In this example, theidentical-color block DK encapsulating pixels indicated by black dots inthe graph area Rn2 is specified as the block DKs to be deleted.

The single-color image generation portion 106B generates an image asshown in FIG. 15B. The image is obtained by replacing a color in theportions corresponding to the areas (portions shown in black color inFIG. 14C) to be processed, in a single-color image shown in FIG. 14B. Tobe more specific, first, an area having the same size as the area to beprocessed is filled with the second most-used color to produce asingle-color image, and, then, the produced single-color image ispainted over the single-color image shown in FIG. 14B that has beenalready generated.

Next, a representative color (third most-used color) set to the largestnumber of pixels among the second non-most--used colors undergoes, as atarget representative color, the processing in step #206 and onward in arepeating and similar manner. In this example, many of the pixels,included in an outer graph area Rg1 having the third largest area, willhave a third most-used color.

If the number of pixels having the third most-used color as arepresentative color, is equal to or larger than a predetermined number(Yes in step #205), an area (area shown in black color in FIG. 15C)resulted from deleting the pixels in the block DKs to be deleted that isso defined in step #208 from an area (area shown in black color in FIG.15A) of pixels having the second non-most-used color undergoes theprocessing in steps #206 to #208 as a next area to be processed.

In other words, the deletion area specifying portion 105B performsprocessing of removing the pixels that are deemed to be noise from anarea (area shown in black color in FIG. 16A) of pixels having the secondnon-most-used color (hereinafter, referred to as “third non-most-usedcolor) other than the third most-used color. This means that anidentical-color block DK is specified as a block DKs to be deleted if itencapsulates pixel groups therein whose color difference with respect tothe third most-used color is equal to or less than a predeterminedthreshold value and if it has a size thereof smaller than apredetermined size (step #207). In this example, the identical-colorblock DK encapsulating pixels shown by black dots in the outer grapharea Rg1 is specified as the block DKs to be deleted.

The single-color image generation portion 106B generates an image, asshown in FIG. 16B, which is resulted from applying the third most-usedcolor to the portion corresponding to the area to be processed (areashown in black color in FIG. 15C) in the image in FIG. 15B that has beenalready generated.

Thereafter, a fourth most-used color, a fifth most-used color, and soonwill sequentially be a target representative color, and the processingin steps #206 to #208 is repeated by using such representative colorsone after another. When the number of pixels of the targetrepresentative color becomes smaller than a predetermined number (No instep #205) in step #205, the processing in step #209 is applied. Notethat, in this embodiment, the description is based on the assumptionthat it is the number of pixels of the fourth most-used color thatbecomes smaller than the predetermined number.

By the time it is found that the number of pixels having the fourthmost-used color becomes smaller than the predetermined number (No instep #205), the single-color image generation portion 106B has generatedan image (image shown in FIG. 16B) by painting single-color images ontop of each another, and then the single-color image generation portion106B completes the image of the circle graph by painting an image of theremaining areas on top of the image so far generated. To be morespecific, the image of the circle graph as shown in FIG. 16D is finishedby painting a portion of the document image, which corresponds to anarea (area shown in black color in FIG. 16C) obtained by removing thepixels of the block DKs to be deleted specified by the deletion areaspecifying portion 105 from the area (area shown in black color in FIG.16A) of pixels having the pixels of the third non-most-used color, ontop of the image (image shown in FIG. 16B) generated so far by thesingle-color image generation portion 106B.

FIG. 17 is a flowchart depicting a flow of overall processes performedby the image forming apparatus 1 when a PDF file is generated.

When a user places a document in the scanner 10 a, selects a PDF formatas a storing format, and instructs the execution of scanning, the imageforming apparatus 1 scans the document (step #301 in FIG. 17) andperforms a process for converting the document image data GD obtained byscanning into a PDF file.

In performing the process, the image forming apparatus 1 appliespreprocessing to the document image data GD (step #302) and obtainsblocks GL encapsulating various objects included in the data (step#303). Further, the image forming apparatus 1 determines which one ofthe types, text, photograph, graph, table, and graphics each of theblocks BK thus obtained belongs to (step #304).

Color correction processing is performed on the graphics/table/graphblock BKz whose type is determined to be one of the graph, table, andgraphics (step #305). The color correction processing was alreadydescribed with reference to FIGS. 6 and 13. It is also possible toprovide both of the functions, namely the color correction processingportions 15A and 15B to the image forming apparatus 1, and a switch orthe like may be used to select therebetween depending on which of thefirst and second methods is used to perform the color correctionprocessing.

Then, an image of a portion serving as a background to the text includedin the block BK which is determined to be the text type and an imageincluded in the block BK which is determined to be the photograph typeundergo resolution reduction processing (step #306).

Data of each of the blocks BK undergoes compression processingcorresponding to the type of the block BK (step #307). In other words,for a block BK of text type, the text data included therein iscompressed using a lossless compression technique such as the MMRmethod. For a block BK of graph, table, or graphics type, data that hasbeen subjected to the color correction processing is compressed using alossless compression technique such as the FLATE method. For a block BKof photograph type and for a background portion of the block BK of texttype, data that has been subjected to resolution reduction processing iscompressed using a lossy compression technique such as the JPEG method.

Then, a PDF file is generated by using the compressed data of each ofthe blocks BK and stored (step #308).

As discussed above, in the present invention, color correction isperformed on a portion that is supposed to be expressed by a singlecolor in an image (digital image data) of graph, table, or graphics sothat such a portion is expressed by a single color. In general, in animage represented by image data obtained by scanning a document, theuneven density, such as that shown in FIG. 4A, in a portion that issupposed to be expressed by a single color becomes more apparent as thearea of that portion becomes larger. With this as a backdrop, accordingto the first method, an image having a largest portion that is supposedto be expressed in a single color is redrawn using the single color byperforming simple processing, thereby increasing the image qualityefficiently and appropriately.

According to the second method, by repeating processing for removingnoise (steps #206 to #208), portions that are supposed to be expressedby a single color are redrawn in decreasing order of size of the areas.As a result, it is possible to generate an image having a better qualitythan in the first method.

As discussed above, according to the present embodiment, an image isgenerated by redrawing an area such as the graph area Rn1 that issupposed to be expressed by a single color using a single representativecolor. As a result, the noise portions included in that area arereplaced with a most-used color, i.e., a representative color used forredrawing. The redrawing may be performed using a color taking a colorof the noise in account, instead of using the most-used color. Forexample, the redrawing may be performed by using a color represented byan average value between the representative color set to the pixels ofthe noise portions and the most-used color. Alternatively, the redrawingmay be performed by using a color represented by a weighted averagevalue based on the number of pixels having the most-used color and thenumber of pixels of the noise portions.

In the present embodiment, the description is given by using the imagesin FIGS. 10A-10D, 14A-14C, 15A-15C, and 16A-16D. However, the colorcorrection may be performed without actually generating pieces of dataof such images.

Note that part of functions shown in FIG. 2 may be implemented byhardware. For example, hardware serving as the input image processingportion and the output image processing portion is provided in the imageforming apparatus 1. The input image processing portion receives thedocument image data GD from the scanner 10 a and performs thereon suchprocessing as color conversion, color correction, resolution conversion,and area discrimination. The output image processing portion performssuch processing as screen control, smoothing processing, and PWMcontrol.

Finally, the configuration and functions of all or part of the imageforming apparatus 1, the details or order of the processing performedthereby, the details of the various pieces of data, and so on can bemodified in various ways within the spirit of the present invention.

1. A subtractive color method comprising: obtaining a most used colorthat is a most popularly used color in an image; extracting small pixelgroups from among pixel groups formed of continued pixels having anidentical color other than the most used color in the image, the smallpixel groups having a color of which a color difference with respect tothe most used color is smaller than a predetermined threshold value andhaving a size thereof that is smaller than a predetermined size; andgenerating a resultant image resulted from applying the most used colorto portions corresponding to the small pixel groups in the image.
 2. Asubtractive color method comprising: a first step of obtaining a mostused color that is a most popularly used color in a first image having apredetermined size; a second step of extracting, as first pixel groups,pixel groups formed of continued pixels having an identical color otherthan the most used color in the first image; and a third step ofgenerating a resultant image by: defining, as second pixel groups, thepixel groups having a color of which a color difference with respect tothe most used color is larger than a predetermined threshold value orhaving a size thereof that is larger than a predetermined size, amongthe first pixel groups thus extracted; obtaining an image, as a secondimage, having an area identical with that of the first image and filledwith the most used color; and replacing portions, in the second image,corresponding to the second pixel groups with the second pixel groups,respectively, so that the resultant image, based on the second image,has the portions of which colors are replaced with colors of thecorresponding second pixel groups, respectively.
 3. A subtractive colormethod comprising: a first step of obtaining a most used color that is amost popularly used color in a first image having a predetermined size;a second step of extracting, as first pixel groups, pixel groups formedof continued pixels having an identical color other than the most usedcolor in the first image; a third step of extracting, as third pixelgroups from among the first pixel groups thus extracted, pixel groupshaving a color of which a color difference with respect to the most usedcolor is smaller than a predetermined threshold value and having a sizethereof that is smaller than a predetermined size; and a fourth step ofgenerating a resultant image by: defining, as second pixel groups, thefirst pixel groups other than the third pixel groups; obtaining animage, as a second image, having an area identical with that of thefirst image and filled with the most used color; and replacing portions,in the second image, corresponding to the second pixel groups with thesecond pixel groups, respectively, so that the resultant image, based onthe second image, has the portions of which colors are replaced withcolors of the corresponding second pixel groups, respectively.
 4. Thesubtractive color method according to claim 3, wherein the methodfurther comprising: obtaining a predetermined number of representativecolors based on a color of each of pixels in a partial original imagethat is an image in an area having a predetermined size in an originalimage; storing, for said each of the pixels included in the partialoriginal image, a representative color closest to the color of said eachof the pixels as a second color of the pixel; and performing the first,second, third, and fourth steps after defining, as the first image, animage having said each of the pixels of the partial original image, thecolor of said each of the pixels being represented by the second colorof the pixel.
 5. A subtractive color processing apparatus that reducescolors in a first image having a predetermined size, the apparatuscomprising: a most used color detection portion that obtains a most usedcolor that is a most popularly used color in the first image; a pixelgroup extraction portion that extracts, as first pixel groups, pixelgroups formed of continued pixels having an identical color other thanthe most used color in the first image; and an image generation portionthat defines, as second pixel groups, the pixel groups having a color ofwhich a color difference with respect to the most used color is largerthan a predetermined threshold value or having a size thereof that islarger than a predetermined size, among the first pixel groups extractedby the pixel group extraction portion; that obtains an image, as asecond image, having an area identical with that of the first image andfilled with the most used color; that replaces portions, in the secondimage, corresponding to the second pixel groups with the second pixelgroups, respectively; and that generates a resultant image, based on thesecond image, having the portions of which colors are replaced withcolors of the corresponding second pixel groups, respectively.
 6. Asubtractive color processing apparatus that reduces colors in a firstimage having a predetermined size, the apparatus comprising: a most usedcolor detection portion that obtains a most used color that is a mostpopularly used color in the first image; a first pixel group extractionportion that extracts, as first pixel groups, pixel groups formed ofcontinued pixels having an identical color other than the most usedcolor in the first image; a second pixel group extraction portion thatextracts, as third pixel groups from among the first pixel groupsextracted by the first pixel group extraction portion, pixel groupshaving a color of which a color difference with respect to the most usedcolor is smaller than a predetermined threshold value and having a sizethereof that is smaller than a predetermined size; and an imagegeneration portion that defines, as second pixel groups, the first pixelgroups other than the third pixel groups that are extracted by thesecond pixel group extraction portion; that obtains an image, as asecond image, having an area identical with that of the first image andfilled with the most used color; that replaces portions, in the secondimage, corresponding to the second pixel groups with the second pixelgroups, respectively; and that generates a resultant image, based on thesecond image, having the portions of which colors are replaced withcolors of the corresponding second pixel groups, respectively.
 7. Animage forming apparatus comprising: a representative color calculationportion that obtains a predetermined number of representative colorsbased on a color of each of pixels in a partial original image that isan image in a predetermined area in an image obtained by scanning anoriginal; a color determination portion that determines a representativecolor, among the representative colors obtained by the representativecolor calculation portion, closest to the color of said each of thepixels as a second color of the pixel, for said each of the pixelsincluded in the partial original image; a most used color detectionportion that obtains a most used color that is a most popularly usedcolor in a first image that is an image having said each of the pixelsof the partial original image, the color of said each of the pixelsbeing represented by the second color that is determined by the colordetermination portion; a first pixel group extraction portion thatextracts, as first pixel groups, pixel groups formed of continued pixelshaving an identical color other than the most used color in the firstimage; a second pixel group extraction portion that extracts, as thirdpixel groups from among the first pixel groups extracted by the firstpixel group extraction portion, pixel groups having a color of which acolor difference with respect to the most used color is smaller than apredetermined threshold value and having a size thereof that is smallerthan a predetermined size; and an image generation portion that defines,as second pixel groups, the first pixel groups other than the thirdpixel groups that are extracted by the second pixel group extractionportion; that obtains an image, as a second image, having an areaidentical with that of the first image and filled with the most usedcolor; that replaces portions, in the second image, corresponding to thesecond pixel groups with the second pixel groups, respectively; and thatgenerates a resultant image, based on the second image, having theportions of which colors are replaced with colors of the correspondingsecond pixel groups, respectively.
 8. A computer-readable storage mediumstoring thereon a computer program executed by a computer that performssubtractive color processing, the computer program causing the computerto perform: obtaining a most used color that is a most popularly usedcolor in a first image having a predetermined size; extracting, as firstpixel groups, pixel groups formed of continued pixels having anidentical color other than the most used color in the first image; andgenerating a resultant image by: defining, as second pixel groups, thepixel groups having a color of which a color difference with respect tothe most used color is larger than a predetermined threshold value orhaving a size thereof that is larger than a predetermined size, amongthe first pixel groups thus extracted; obtaining an image, as a secondimage, having an area identical with that of the first image and filledwith the most used color; and replacing portions, in the second image,corresponding to the second pixel groups with the second pixel groups,respectively, so that the resultant image, based on the second image,has the portions of which colors are replaced with colors of thecorresponding second pixel groups, respectively.
 9. A computer-readablestorage medium storing thereon a computer program executed by a computerthat performs subtractive color processing, the computer program causingthe computer to perform: obtaining a most used color that is a mostpopularly used color in a first image having a predetermined size;extracting, as first pixel groups, pixel groups formed of continuedpixels having an identical color other than the most used color in thefirst image; extracting, as third pixel groups from among the firstpixel groups thus extracted, pixel groups having a color of which acolor difference with respect to the most used color is smaller than apredetermined threshold value and having a size thereof that is smallerthan a predetermined size; and generating a resultant image by: definingas second pixel groups, the first pixel groups other than the thirdpixel groups; obtaining an image, as a second image, having an areaidentical with that of the first image and filled with the most usedcolor; and replacing portions, in the second image, corresponding to thesecond pixel groups with the second pixel groups, respectively, so thatthe resultant image, based on the second image, has the portions ofwhich colors are replaced with colors of the corresponding second pixelgroups, respectively.